Data from 'Data.gov.in'
File names:
>>crcCAW.CSV : `Number of Crime against women`
>>pacCAW.CSV : 'Number of Person Involved in Crime against Women'
Here In this Notebook we will separate all crimes against women according to category and remove all the rows about Total Crimes. and separate all the crimes in individual dataframe.. Hope we'll succed
In [2]:
#Lets now import necessary libraries which will help us
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
In [3]:
crimes = pd.read_csv('crcCAW.csv')
In [5]:
crimes.head() #lets give it a look
Out[5]:
In [16]:
pd.unique(crimes['CRIME HEAD']) # we got all crimes releated to women in the datframe now we can extract the crimes
#pd.unique(df.values.ravel())
Out[16]:
First we will remove all the entries releated to Total of the crimes as we don't want total now
In [28]:
#df = df[df.line_race != 0] this is we are going to do to remove the total entries
crimes_ver1 = crimes[crimes['CRIME HEAD']!='TOTAL CRIMES AGAINST WOMEN']
In [29]:
crimes_ver2 = crimes_ver1[crimes_ver1['STATE/UT']!='TOTAL (ALL-INDIA)']
In [31]:
crimes_ver3 = crimes_ver2[crimes_ver2['STATE/UT']!='TOTAL (STATES)']
In [34]:
crimes_ver4 = crimes_ver3[crimes_ver3['STATE/UT']!='TOTAL (UTs)']
In [36]:
crimes_ver4.to_csv('crimescleaned.csv')
In [46]:
name = 'kartik'
import os
DIR_PATH = os.path.abspath
DIR_
In [49]:
os.walk(',')
Out[49]:
In [ ]: